﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LanguagePolish.Base;

namespace LanguagePolish.ViewModels
{
    class AdditionalInfoViewModel : BaseViewModel
    {
        public AdditionalInfoViewModel()
        {
            LinksProvider.Model.CollectionsChanged += Model_CollectionsChanged;
        }

        void Model_CollectionsChanged(object sender, EventArgs e)
        {
            OnPropertyChanged("TotalStudents");
            OnPropertyChanged("TotalClasses");
            OnPropertyChanged("TotalTeachers");
        }

        public int TotalStudents 
        {
            get { return LinksProvider.Model.EntityContext.Students.DefaultIfEmpty().Count(); }
        }

        public int TotalClasses
        {
            get { return LinksProvider.Model.EntityContext.Classes.DefaultIfEmpty().Count(); }
        }

        public int TotalTeachers
        {
            get { return LinksProvider.Model.EntityContext.Teachers.DefaultIfEmpty().Count(); }
        }
    }
}
